package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.dto.DeviceDto;
import com.zzyl.dto.DevicePageQueryDto;
import com.zzyl.entity.Device;
import com.zzyl.entity.DeviceData;
import com.zzyl.vo.DeviceDataGraphVo;
import com.zzyl.vo.DeviceVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface DeviceMapper {

    @Select("select count(1) from device where device_name = #{deviceName}")
    int queryDevice(String deviceName);

    void insert(Device device);

    Page<DeviceVo> pageQueryDevice(@Param("deviceName") String deviceName,@Param("locationType") Integer locationType,
                                   @Param("productKey") String productKey);

    DeviceVo queryDeviceDetail(String iotId);

    void UpdateDevice(Device device);

    void delete(String iotId);

    List<DeviceDataGraphVo> queryDeviceDataListByDay(String iotId, String functionId, LocalDateTime startDate, LocalDateTime endDate);

    List<DeviceDataGraphVo> pageQueryAlertData(String iotId, String functionId, LocalDateTime startDate, LocalDateTime endDate);

//    void batchDeviceData(List<DeviceData> list);
}

























